
<style>
.privilegeManage .privilegeManageTable{
  width: 100%;
  line-height: 40px;
  border-collapse: collapse;
  text-align: left;
  color: #777;
  font-size:12px ;
  
}
.privilegeManage .privilegeManageTable td{
  border: none;
  border-bottom: 1px solid rgb(194, 192, 192);
}
.privilegeManage .privilegeManageTable a{
  color: #777;
}
.privilegeManage .privilegeManageTable th:last-child{
  text-align: center;
}
.privilegeManage .privilegeManageTable td:last-child{
  text-align: center;
}
</style>


<div class="privilegeManage">
  <div class="option-div">
    <button id="toAdd" class="btn btn-success">添加</button>
  </div>
  <div>
    <table class="privilegeManageTable">
      <thead>
        <th>名称</th>
        <th>路径</th>
        <th>类型</th>
        <th>图标</th>
        <th>状态</th>
        <th>操作</th>
      </thead>
      <tbody>
        <td>名称</td>
        <td>路径</td>
        <td>类型</td>
        <td>图标</td>
        <td>状态</td>
        <td>操作</td>
      </tbody>
    </table>
  </div>
</div>

<script>
myAjax.get(api.PRIVILEGE_FINDPRIVILEGETREE).then((res)=>{
    //清空节点
    $(".privilegeManage tbody").empty();
    console.log(res)
    let arr=res.data;
    if(arr.length>0){
      arr.forEach((item,index)=>{
        $(".privilegeManage tbody").append($(`
        <tr>
        <td>${item.name}</td>
        <td>${item.route}</td>
        <td>${item.type}</td>
        <td>${item.icon}</td>
        <td>${item.parentId}</td>
        <td>
          <a href="#">移除</a>
          <a href="#">修改</a>
        </td>
      </tr>`))
      })
    }
  })
</script>